import 'package:capsule/models/title_value_pair.dart';
import 'package:capsule/widgets/count_board.dart';
import 'package:flutter/material.dart';

class CountPanel extends StatefulWidget {
  final List<TitleValuePair> countPairs;
  const CountPanel({super.key, required this.countPairs});

  @override
  State<StatefulWidget> createState() => CountPanelState();
}

class CountPanelState extends State<CountPanel> {
  @override
  Widget build(BuildContext context) {
    return Wrap(
      crossAxisAlignment: WrapCrossAlignment.start,
      runSpacing: 5,
      spacing: 5,
      children: [
        for (final TitleValuePair pair in widget.countPairs)
          CountBoard(
            title: pair.title,
            count: pair.value,
            titleColor: pair.color,
            countColor: Colors.white,
          )
      ],
    );
  }
}
